ios 逆向|frida hook 简单使用

您所在的位置:网站首页 frida hook原理 ios 逆向|frida hook 简单使用

ios 逆向|frida hook 简单使用

2022-05-12 15:19| 来源: 网络整理| 查看: 265

文章目录[隐藏]

ios 逆向 4 / 4前言 ida 反编译 ida 分析 frida hook ios 逆向 4 / 4 ios 逆向|使用 checkra1n 越狱 ios 逆向|frida-ios-dump 脱壳反编译 ios 逆向|lldb 动态调试 ios 逆向|frida hook 简单使用 前言

这一篇来说一说 ios frida hook 的使用 样本还是熟悉的狗东版本 10.4.4 博主初学 ios 逆向,很多操作也没啥技巧,也不知道有啥方法工具,只能使用本方法了

ida 反编译

脱完壳后会生成一个 ipa 文件,可以直接拖进 ida,选择主程序打开即可 或者先解压,直接把主程序拖进 ida 也行

第一次打开需要很久,狗东的我是跑了一个晚上第二天才索引完成

等待索引完成就可以开始操作了,不然会卡到怀疑人生

ida 分析

打开字符串窗口搜索 sign 关键词,点进去按 x 查看交叉引用

最终是定位到这里,这里是对 encrypt 函数的执行结果进行 md5 加密,点进去分析一下

进来往下拉一点就能看到熟悉的 0 1 2 三个分支加密逻辑了,最后在进行 base64编码

下面来简单使用下 frida

frida hook function hookFunction() { var JDSignCryptManager = eval('ObjC.classes.JDSignCryptManager["+ cryptWithPartion:cryptID:content:encrypt:"]'); console.log('JDSignCryptManager: ', JDSignCryptManager); Interceptor.attach(JDSignCryptManager.implementation, { onEnter: function (args) { console.log('JDSignCryptManager args 2: ', args[2]); console.log('JDSignCryptManager args 3: ', args[3]); console.log('JDSignCryptManager args 4: ', ObjC.Object(args[4])); }, onLeave: function (ret) { console.log('JDSignCryptManager ret : ', ObjC.Object(ret)); } }); var JDCPAHashManager = eval('ObjC.classes.JDCPAHashManager["+ md5:"]'); console.log('JDCPAHashManager: ', JDCPAHashManager); Interceptor.attach(JDCPAHashManager.implementation, { onEnter: function (args) { console.log('JDCPAHashManager args 2: ', ObjC.Object(args[2])); }, onLeave: function (ret) { console.log('JDCPAHashManager res : ', ObjC.Object(ret)); } }); } hookFunction();

hook 两个加密函数的输入输出

执行 frida -UF -l hook.js | tee hook.log 成功输出相关信息

上面这段代码是直接 hook 函数,当然还可以 inlinehook

function inlineHook() { var baseOffset = 0x100000000; var base = Module.findBaseAddress('JD4iPhone'); console.log('base: ', base); var sub_105794200 = base.add(0x105794200 - baseOffset); console.log('sub_105794200: ', sub_105794200); Interceptor.attach(ptr(sub_105794200), { onEnter: function (args) { console.log(`sub_105794050 args 0: `, args[0]); console.log(`sub_105794050 args 1: `, args[1]); console.log(`sub_105794050 args 2: `, args[2]); console.log(`sub_105794050 args 3: \n`, hexdump(args[3], {length: args[4].toInt32(), header: false})); console.log(`sub_105794050 args 4: `, args[4]); }, onLeave: function (ret) { console.log(`sub_105794050 res : ${ret}\n`); } }); } inlineHook();

hook 012 的其中一个加密函数

同样执行 frida -UF -l hook.js | tee hook1.log 成功输出相关信息



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3